package com.yingjia.yingjiauniversity.json.constant;

/**
 * Copyright:   Copyright(C) 2010-2015 KEDACOM LTD.
 * Project:     ptt
 * Module:      com.kedacom.location.manager
 * Description: 定位状态码
 * Author:      Lynn
 * Createdate:  2017/4/10
 * Version:     V0.1
 */

public enum LocationStatusCode {
    StatusOk(200, "有效定位结果"),

    //baidu
    BDStatusNone(0, "无效定位结果"),
    BDStatusCriteriaException(62, "无法定位结果"),//一般由于定位SDK内部检测到没有有效的定位依据 比如在飞行模式下就会返回该定位类型， 一般关闭飞行模式或者打开wifi就可以再次定位成功
    BDStatusNetWorkException(63, "网络连接失败"),//一般由于手机无有效网络连接导致，请检查手机是否能够正常上网
    BDStatusOffLineLocationFail(67, "离线定位失败"),//一般由于手机网络不通 会请求定位SDK内部的离线定位策略但失败了，无效定位67
    BDStatusServerError(167, "server定位失败,没有对应的位置信息"),
    BDStatusServerDecryptError(162, "server解密定位请求失败"),//请检查SO文件是否加载正常
    BDStatusServerCheckKeyError(505, "server校验KEY失败"),

    BDStatusGpsLocation(61, "GPS定位结果"),
    BDStatusOffLineLocation(66, "离线定位成功"),
    BDStatusNetWorkLocation(161, "网络定位结果成功"),

    //system
    SystemStatusGPSTemporarilyUnavailable(1, "GPS暂停服务"),
    SystemStatusGPSOutOfService(201, "GPS不在服务区"),
    SystemStatusProviderDisabled(202, "GPS禁用");

    private int status;
    private String statusDesc;

    public int getStatus() {
        return status;
    }

    public String getStatusDesc() {
        return statusDesc;
    }

    LocationStatusCode(int status, String statusDesc) {
        this.status = status;
        this.statusDesc = statusDesc;
    }

    public static String getDesc(int status) {
        for (LocationStatusCode c : LocationStatusCode.values()) {
            if (c.getStatus() == status) {
                return c.getStatusDesc();
            }
        }
        return "";
    }
}
